import axios from 'axios';
import { req, upimgdata } from './axiosFun';
// 获取重定向地址
export const redirectUrl = (data = {}) => { return req("post", "/Home/Login/redirect_url?url=" + data) };
/**
 * 登陆
 */
export const UserLand = (data = {}) => { return req("post", "/Home/Login/check_login?code=" + data) };
/**
 * 文件上传
 */
export const FileUpload = (file) => { return upimgdata(file) };

// 获取前端配置参数
export const agentConfig = (data = {}) => { return req("post", "/Home/Index/agent_config?url=" + data) };
/**
 * 系统管理
 */
//  部门管理
export const departmentList = (data = {}) => { return req("post", "/System/Org/department_list", data) }; // 获取部门列表
export const pace_departmentList = (data = {}) => { return req("post", "/System/Org/pace_department_list", data) }; // 同步部门及成员
export const departmentUserList = (data = {}) => { return req("post", "/System/Org/department_user_list", data) }; // 部门成员列表
//  标签库
export const labelLibraryList = (data = {}) => { return req("post", "/System/Crm/get_corp_tag_list?group_id=" + data) };
export const labelLibrarySy = (data = {}) => { return req("post", "/System/Crm/pace_corp_tag_list", data) };
export const addCorpTagGroup = (data = {}) => { return req("post", "/System/Crm/add_corp_tag_group", data) }; // 添加标签组
export const addCorpTag = (data = {}) => { return req("post", "/System/Crm/add_corp_tag", data) }; // 添加标签
export const editCorpTag = (data = {}) => { return req("post", "/System/Crm/edit_corp_tag", data) }; // 编辑标签
export const delCorpTag = (data = {}) => { return req("post", "/System/Crm/del_corp_tag", data) }; // 删除标签


// 企业等级
export const customerLevelList = (data = {}) => { return req("post", "/System/Crm/customer_level", data) };
export const customerLevelSave = (data = {}) => { return req("post", "/System/Crm/save_customer_level", data) };
export const customerLevelDel = (data = {}) => { return req("post", "/System/Crm/del_customer_level?id=" + data) };
// 客户来源
export const sourcelList = (data = {}) => { return req("post", "/System/Crm/source", data) };
export const sourceSave = (data = {}) => { return req("post", "/System/Crm/save_source", data) };
export const sourceDel = (data = {}) => { return req("post", "/System/Crm/del_source?id=" + data) };
// 跟进状态
export const followStatuslList = (data = {}) => { return req("post", "/System/Crm/follow_status", data) };
export const followStatusSave = (data = {}) => { return req("post", "/System/Crm/save_follow_status", data) };
export const followStatusDel = (data = {}) => { return req("post", "/System/Crm/del_follow_status?id=" + data) };
// 销售阶段
export const stageList = (data = {}) => { return req("post", "/System/Crm/sale_stage", data) };
export const stageSave = (data = {}) => { return req("post", "/System/Crm/save_sale_stage", data) };
export const stageDel = (data = {}) => { return req("post", "/System/Crm/del_sale_stage?id=" + data) };
/**
 * CRM
 */
// 地区列表
export const addressList = (data = {}) => { return req("post", "/Home/Index/area?pid=" + data) };
// 客户-企业
export const customerList = (data = {}) => { return req("post", "/Home/Customer/customer_list", data) };
export const customerSave = (data = {}) => { return req("post", "/Home/Customer/save_customer", data) };
export const customerDel = (data = {}) => { return req("post", "/Home/Customer/del_customer?id=" + data) };
export const findCustomer = (data = {}) => { return req("post", "/Home/Customer/find_customer?id=" + data) }; // 获取企业详情
// 公海
export const seaList = (data = {}) => { return req("post", "/Home/Sea/sea_list", data) }; // 列表
export const getOpenSea = (data = {}) => { return req("post", "/Home/Sea/get_open_sea?ids=" + data) }; // 领取公海
export const planOpenSea = (data = {}) => { return req("post", "/Home/Sea/plan_open_sea", data) }; // 分配公海

// 客户群
export const groupchatList = (data = {}) => { return req("post", "/Home/External/groupchat_list", data) }; // 列表
export const getGroupchatList = (data = {}) => { return req("post", "/Home/External/get_groupchat_list", data) }; // 同步
export const groupchatMember = (data = {}) => { return req("post", "/Home/External/groupchat_member", data) }; // 详情
// 联系人
export const contactsList = (data = {}) => { return req("post", "/Home/Contacts/contacts_list", data) };
export const contactsSave = (data = {}) => { return req("post", "/Home/Contacts/save_contacts", data) };
export const contactsDel = (data = {}) => { return req("post", "/Home/Contacts/del_contacts?id=" + data) };
export const followAdd = (data = {}) => { return req("post", "/Home/Contacts/add_follow", data) };
export const searchContacts = (data = {}) => { return req("post", "/Home/Contacts/search_contacts", data) };
export const findContacts = (data = {}) => { return req("post", "/Home/Contacts/find_contacts?id=" + data) }; // 联系人详情
export const addShare = (data = {}) => { return req("post", "/Home/Contacts/add_share", data) }; // 添加共享人
export const putOpenSea = (data = {}) => { return req("post", "/Home/Contacts/put_open_sea?id=" + data) }; // 放入公海

// 外部联系人
export const getFollowUserList = (data = {}) => { return req("post", "/Home/External/get_follow_user_list", data) }; // 同步外部联系人
export const getExternalList = (data = {}) => { return req("post", "/Home/External/get_external_list", data) }; // 微信客户列表
export const searchExternalList = (data = {}) => { return req("post", "/Home/External/search_external_list?kw=" + data) }; // 微搜索微信客户列表-外部联系人下拉数据

// 跟进记录（工作记录）
export const followList = (data = {}) => { return req("post", "/Home/Contacts/follow_list", data) };
// 销售机会
export const salesList = (data = {}) => { return req("post", "/Home/Sale/sales_list", data) };
export const salesSave = (data = {}) => { return req("post", "/Home/Sale/save_sales", data) };
export const giveSales = (data = {}) => { return req("post", "/Home/Sale/give_sales", data) };
export const findSales = (data = {}) => { return req("post", "/Home/Sale/find_sales?id=" + data) }; // 销售机会详情

// 销售目标
export const salesTarget = (data = {}) => { return req("post", "/Home/Sale/sales_target", data) }; // 销售目标
export const saveSalesTarget = (data = {}) => { return req("post", "/Home/Sale/save_sales_target", data) }; // 添加目标
export const completeSalesTarget = (data = {}) => { return req("post", "/Home/Sale/complete_sales_target", data) }; // 目标完成

// 回收站
export const recContactsList = (data = {}) => { return req("post", "/Home/Recycle/rec_contacts_list", data) }; // 联系人回收站
export const recCustomerList = (data = {}) => { return req("post", "/Home/Recycle/rec_customer_list", data) }; // 企业回收站


export default {
  redirectUrl,
  agentConfig,
  departmentList,
  pace_departmentList,
  departmentUserList,
  addressList,
  UserLand,
  FileUpload,
  labelLibraryList,
  labelLibrarySy,
  addCorpTagGroup,
  addCorpTag,
  editCorpTag,
  delCorpTag,
  customerLevelList,
  customerLevelSave,
  customerLevelDel,
  customerList,
  customerSave,
  customerDel,
  findCustomer,
  seaList,
  getOpenSea,
  planOpenSea,
  contactsList,
  contactsSave,
  contactsDel,
  followList,
  followAdd,
  searchContacts,
  findContacts,
  addShare,
  putOpenSea,
  getFollowUserList,
  getExternalList,
  searchExternalList,
  sourcelList,
  sourceSave,
  sourceDel,
  followStatuslList,
  followStatusSave,
  followStatusDel,
  stageList,
  stageSave,
  stageDel,
  salesList,
  salesSave,
  giveSales,
  findSales,
  salesTarget,
  saveSalesTarget,
  completeSalesTarget,
  groupchatList,
  getGroupchatList,
  groupchatMember,
  recContactsList,
  recCustomerList,
}